import { workTimeoutRemind } from '@/api/order'

import { ref } from 'vue'
import { TimeoutTipForm } from './types'

export default function (ids: Array<string>) {
  // 表单
  const form = ref<TimeoutTipForm>({
    workIds: ids,
    remindEmpIds: [],
    remindEmpType: [],
    type:1,
    conditionType:null
  })

  // 工单超时提醒加载
  const workTimeoutRemindLoading = ref(false)

  // 工单超时提醒方法
  const workTimeoutRemindFn = async () => {
    workTimeoutRemindLoading.value = true
    const res = await workTimeoutRemind(form.value)
    workTimeoutRemindLoading.value = false
    return res.data as { code: number; data: any; message: string; success: boolean }
  }

  return {
    form,
    workTimeoutRemindLoading,
    workTimeoutRemindFn,
  }
}
